package com.kadron.creator;

import com.kadron.action.KDiscountModel;
import com.kadron.dao.KDiscountDAO;
import com.kadron.datamodel.KModelCreator;
import com.kadron.entity.Discount;

public class KDiscountModelCreator implements KModelCreator {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5431750255930389850L;

	private KDiscountDAO discountDAO;
	
	public KDiscountModelCreator(KDiscountDAO discountDAO) {
		super();
		this.discountDAO = discountDAO;
	}
	
	@Override
	public KDiscountModel create(long id) {
		Discount discount = (Discount) discountDAO.find(id, Discount.class);
		KDiscountModel model = new KDiscountModel(discount);
		return model;
	}
	
	public KDiscountModel getNew() {
		Discount discount = new Discount();
		KDiscountModel model = new KDiscountModel(discount);
		return model;
	}

}
